<?php

namespace api\channel\mobile;

use app\model\BaseSupplier;
use app\model\MobileOrder;
use app\model\MovieOrder;
use Carbon\Carbon;
use think\Exception;

class MobileSelf
{
    public function __construct()
    {
        /**
         * 赋值
         */
        $this->supplierInfo = BaseSupplier::query()
            ->where('code','taototo')
            ->find();

        if (empty($this->supplierInfo)){
            throw new Exception('淘兔兔的供应商不存在');
        }



    }


    public function orders($params)
    {
        $page = $params['page'];

        //后面再优化分页： 和更新数据 限制条数
        $data = MobileOrder::query()

//          ->whereIn('settle_status',[MobileOrder::SETTLE_STATUS_WAIT,MobileOrder::SETTLE_STATUS_FINISH]) //充值中的不过来
//                ->where('updated_at','>' , Carbon::now()->subHours(5)->format('Y-m-d H:i:s'))
                ->where('updated_at','>' , Carbon::parse('2022-05-11 17:31:50'))
            ->limit(10)
            ->page($page)
            ->select()->toArray();

        $res['data'] = $data;

        return $res;
    }



}